Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play ansible roles on host #936

Merged
merged 3 commits into from
Jul 3, 2023
Merged

Conversation

lhellebr
Copy link
Contributor

Add a method to play ansible roles on a host.
Example:

host = api.Host().search(query={'search': f'name={rex_contenthost.hostname}'})[0]
host.play_roles()

@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.07 🎉

Comparison is base (162e767) 92.19% compared to head (78efef2) 92.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #936      +/-   ##
==========================================
+ Coverage   92.19%   92.26%   +0.07%     
==========================================
  Files           6        6              
  Lines        3037     3078      +41     
==========================================
+ Hits         2800     2840      +40     
- Misses        237      238       +1     
Impacted Files Coverage Δ
nailgun/entities.py 91.34% <100.00%> (+0.10%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lhellebr lhellebr added CherryPick PR needs CherryPick to previous branches 6.12.z 6.13.z 6.14.z labels Jun 15, 2023
nailgun/entities.py Outdated Show resolved Hide resolved
@@ -4332,6 +4332,25 @@ def bulk_available_incremental_updates(self, synchronous=True, timeout=None, **k
response = client.post(self.path('bulk/available_incremental_updates'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def play_roles(self, synchronous=True, timeout=None, **kwargs):
"""Play all assigned ansible roles
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As same endpoint for both host and host group, so it'd be nice to cover this func for hostgroup too, wdyt?

Suggested change
"""Play all assigned ansible roles
"""Play all assigned ansible roles on host

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would. I did what I needed for my tests, there's a lot of things that would be nice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, asked it because its a same endpoint and would be just copy-pasta! :) non-blocking though

@lhellebr lhellebr requested review from Gauravtalreja1 and a team June 21, 2023 14:46
Gauravtalreja1
Gauravtalreja1 previously approved these changes Jun 21, 2023
nailgun/entities.py Outdated Show resolved Hide resolved
@JacobCallahan JacobCallahan merged commit 995aa7f into SatelliteQE:master Jul 3, 2023
8 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 3, 2023
* Play ansible roles on host

* Coverage

* Actually returns task id

(cherry picked from commit 995aa7f)
Gauravtalreja1 pushed a commit that referenced this pull request Jul 18, 2023
* Play ansible roles on host

* Coverage

* Actually returns task id

(cherry picked from commit 995aa7f)

Co-authored-by: Lukáš Hellebrandt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z 6.13.z 6.14.z CherryPick PR needs CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants